//-*-C++-*-
/***************************************************************************
 *
 *   Copyright (C) 2003 by Haydon Knight
 *   Licensed under the Academic Free License version 2.1
 *
 ***************************************************************************/

/*

A ChannelOrder converts a BitSeries into a TimeSeries

By default, assumes within the BitStream dim varies most quickly, then pol, then chan, then time
This assumption is not specified anywhere else- only in instantiations generated by ChannelOrder and TimeOrder is this ordering assumed
nbit must be 32

*/

#ifndef __ChannelOrder_h
#define __ChannelOrder_h

#include "dsp/TimeSeries.h"
#include "dsp/BitSeries.h"
#include "dsp/Transformation.h"

namespace dsp {

  class ChannelOrder : public Transformation<BitSeries,TimeSeries> {

  public:

    enum ChangingVariable { Channel, Polarisation };

    //! Null constructor- always outofplace
    ChannelOrder();

    //! Destructor
    virtual ~ChannelOrder();

    //! Set the most rapidly varying dimension, out of channel and polarisation
    void set_rapid_variable( ChangingVariable _rapid){ rapid = _rapid; }

    //! Inquire the most rapidly varying dimension, out of channel and polarisation
    ChangingVariable get_rapid_variable(){ return rapid; }

  protected:

    virtual void transformation ();

    //! The most rapidly changing variable
    ChangingVariable rapid;

  };

}

#endif
